<div class="wrapper-md ng-scope">
  <div class="row">

    <div class="panel panel-default">
      <tabset class="tab-container" >

        <tab heading="区域列表" active="status.active" ng-click="cancel()">
          <div class="panel-body">
            <table id ="treetable" class="table table-striped table-bordered table-condensed tree_table" style="display: none;">
              <thead>
                <tr>
                  <th style="width: 15%;text-align:center;">区域名称</th>
                  <th style="width: 4%;text-align:center;">区域编码</th>
                  <th style="width: 5%;text-align:center;">区域类型</th>
                  <th style="width: 5%;text-align:center;">备注</th>
                  <th style="width: 8%;text-align:center;">操作</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="area in area_list" id="{{area.id}}" pid="{{area.parent_id}}" sort={{area.sort}} arealoadover>
                  <td style="padding: 8px 5px"><a href ng-click="update(area)" style="color:#2fa4e7">{{area.name}}</a></td>
                  <td style="text-align:center;">{{area.code}}</td>
                  <td>{{area.area_type}}</td>
                  <td style="text-align:center;">{{area.remarks}}</td>
                  <td style="padding: 8px 5px" align="center">
                    <button type="button" class="btn btn-info btn-xs" ng-click="add(area)">添加下级</button>
                    <button type="button" class="btn btn-info btn-xs" ng-click="update(area)">修改</button>
                    <button type="button" class="btn btn-danger btn-xs" ng-click="delete(area)">删除</button>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </tab>

        <tab heading={{tabname.name}} ng-click="add(area_list[0])" active="tabname.active">
          <div class="panel-body">
            <form name="form1" class="form-horizontal form-validation ng-pristine ng-valid ng-valid-required">
              <div class="form-group">
                <label class="col-lg-2 control-label">上级区域:</label>
                <div class="col-lg-4">
                  <ui-select ng-model="obj.parent_id" theme="bootstrap">
                    <ui-select-match>{{$select.selected.name}}</ui-select-match>
                    <ui-select-choices repeat="item.id as item in super_area_list | filter: $select.search">
                      <span ng-bind-html="item.name | highlight: $select.search"></span>
                    </ui-select-choices>
                  </ui-select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">区域名称:</label>
                <div class="col-lg-4">
                  <input type="text" class="form-control" ng-model="obj.name" placeholder='必填'>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">区域编码:</label>
                <div class="col-lg-4">
                  <input type="text" class="form-control" ng-model="obj.code">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">区域类型:</label>
                <div class="col-lg-4">
                  <select ng-model="obj.type" class="form-control">
                    <option value="1">国家</option>
                    <option value="2">省份、直辖市</option>
                    <option value="3">地市</option>
                    <option value="4">区县</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">排序:</label>
                <div class="col-lg-4">
                  <input type="number" class="form-control" ng-model="obj.sort">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-2 control-label">备注:</label>
                <div class="col-lg-4">
                  <textarea id="remarks" class="form-control" rows="3" ng-model="obj.remarks"></textarea>
                </div>
              </div>
            </form>
            <div class="col-lg-2"></div>
            <div class="col-lg-4">
              <button class="btn btn-primary btn-rounded" ng-click="save()">保存</button>
              <button class="btn btn-default btn-rounded" ng-click="cancel()">取消</button>
            </div>
          </div>
        </tab>
        

      </tabset>
    </div>
  </div>
</div>


